﻿using System;
using System.Collections.Generic;
using InvestmentIntelligence.DbModel.Models;

namespace InvestmentIntelligence.Data.Repository.Comparers.EntityModelsComparers
{
    public class CountryCodeComparer : IEqualityComparer<Country>
    {
        public bool Equals(Country x, Country y)
        {
            return x.CountryCode.Equals(y.CountryCode, StringComparison.InvariantCultureIgnoreCase);
        }

        public int GetHashCode(Country obj)
        {
            return obj.CountryCode == null ? 0 : obj.CountryCode.ToUpper().GetHashCode();
        }
    }
}